﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;


namespace Tesla.Service.DataContracts
{
    [DataContract]
    public class BaseDC : IValidatable<BaseDC>
    {
        public enum CRUDState
        {
            nochange = 0,
            create,
            update,
            delete            
        }

        [DataMember]
        public int UpdateState { get; set; }

        [DataMember]
        public string ModifiedBy { get; set; }

        [DataMember]
        public DateTime ModifiedDate { get; set; }

        [DataMember]
        public string CreatedBy { get; set; }

        [DataMember]
        public DateTime CreatedDate { get; set; }
        
        [DataMember]
        public string CreateUpdateSymbol { get; set; }

        [DataMember]
        public int Order { get; set; }

        public bool Validate(IValidator<BaseDC> validator, out IEnumerable<string> brokenRules)
        {
            brokenRules = validator.BrokenRules(this);
            return validator.IsValid(this);
        }
    }
}
